package bill

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/openmerch/bill"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// BillService 开放商户账单服务
//
// @author liaochangyi
// @since 2025-01-25
type BillService struct {
	*services.BaseService
}

// NewBillService 创建账单服务实例
func NewBillService(config *core.Config) *BillService {
	return &BillService{
		BaseService: services.NewBaseService(config),
	}
}

// QueryBillDownload 查询账单下载
func (s *BillService) QueryBillDownload(request *bill.BillDownloadQueryRequest) (*bill.BillDownloadQueryResponse, error) {
	response := bill.NewBillDownloadQueryResponse()
	err := s.Post(request, response, "/open/bill/download/query")
	return response, err
}

func (s *BillService) OrderInfoQuery(request *bill.OrderInfoQueryRequest) (*bill.OrderInfoQueryResponse, error) {
	response := bill.NewOrderInfoQueryResponse()
	err := s.Post(request, response, request.GetApiUrl())
	return response, err
}

func (s *BillService) SettleBillQuery(request *bill.SettleBillQueryRequest) (*bill.SettleBillQueryResponse, error) {
	response := bill.NewSettleBillQueryResponse()
	err := s.Post(request, response, request.GetApiUrl())
	return response, err
}
